home *** CD-ROM | disk | FTP | other *** search
/ MacHome 2001 June / MacHome Magazine Demo Disc June 2001.iso / Stuff / Software / Productivity / KnowledgeMiner 3.2.1 / AppleScript Support / 1 row up next >
Encoding:
Text File  |  2000-09-18  |  1.1 KB  |  45 lines  |  [TEXT/ToyS]

  1. -- Input values
  2. set targetColumn to 2 -- the index of the target column
  3. set the newValue to 123 -- the new value of the last row
  4.  
  5. set repeatNTimes to 0
  6.  
  7. -- Execute
  8. repeat with i from targetColumn to (targetColumn + repeatNTimes)
  9.     ShiftOneRowUp(i, newValue)
  10. end repeat
  11.  
  12. ---------------------
  13. on ShiftOneRowUp(targetColumn, newValue)
  14.     tell application "KnowledgeMiner 3.2"
  15.         activate
  16.         
  17.         -- find rowindex of the last value in target column
  18.         set lastrow to (rowIndex of second cell of column targetColumn whose kind is not "valuecell") - 1
  19.         
  20.         --copy first value to clipbord
  21.         select cell 2 of column targetColumn
  22.         copy
  23.         
  24.         --read values of target column to valueList
  25.         set valueList to (value of every cell of column targetColumn whose rowIndex is greater than 2 ¬
  26.             and rowIndex is less than or equal to lastrow)
  27.         
  28.         -- how many values were read
  29.         set n to count valueList
  30.         
  31.         -- write values of valueList to new location
  32.         set value of cells 2 thru (1 + n) of column targetColumn to valueList
  33.         
  34.         -- write new value to last row of target column
  35.         set value of cell lastrow of column targetColumn to newValue
  36.         
  37.     end tell
  38. end ShiftOneRowUp
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.